﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OF.Component.BLL;
using OF.Component.Model;
using OF.Component.Base;
using OF.Utility;

namespace OpSystem.manage.ajax
{
    public partial class ajaxauthrole : OpBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthorityRoleMenuRelaOperate.DeleteRoleMenu(RoleID,SysId);
            string[] strFIDAll = MenuIDList.Split(',');
            string guid = Guid.NewGuid().ToString();
            foreach (string strID in strFIDAll)
            {
                if (strID == "") continue;
                AuthorityRoleMenuRelaInfo info = new AuthorityRoleMenuRelaInfo
                {
                    CreateDateTime = DateTime.Now,
                    RoleID = RoleID,
                    IsActive = 1,
                    MenuID = int.Parse(strID),
                    OperationID = Guid.NewGuid(),
                    SystemID = SysId,
                    UpdateTime = DateTime.Now
                };
                AuthorityRoleMenuRelaOperate.Insert(info);
              
            }
           

        }
        private int RoleID
        {
            get
            {
                if (!string.IsNullOrEmpty(Request.Params["roleid"]))
                {
                    return EConvert.ToInt(Request.Params["roleid"]);
                }
                else
                {
                    return 0;
                }
            }
        }
        private string MenuIDList
        {
            get
            {
                if (!string.IsNullOrEmpty(Request.Params["menuid"]))
                {
                    return Convert.ToString(Request.Params["menuid"]);
                }
                else
                {
                    return "";
                }
            }
        }
        private int SysId
        {
            get
            {
                if (!string.IsNullOrEmpty(Request.Params["sysid"]))
                {
                    return EConvert.ToInt(Request.Params["sysid"]);
                }
                else
                {
                    return 0;
                }
            }
        }
    }
}